#ifndef RECTIMAGEPROGRESS_H
#define RECTIMAGEPROGRESS_H

#include <QObject>
#include <QtWidgets>
#include <QImage>
#include <QPixmap>

#include <qwt_plot.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_curve.h>
#include <qwt_legend.h>
#include <qwt_point_data.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_magnifier.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_picker.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_magnifier.h>
#include <qwt_symbol.h>

class RectImageProgress : public QObject
{
	Q_OBJECT

public:
	RectImageProgress(QObject *parent=0);
	~RectImageProgress();
	void getPlotData(QImage image, QRect rect);
	void structCurData(QVector<int> vec);
	void stateChange();
	void getRectData(QRect R);
	void peakValueSearch(QVector<int> vector);
	QVector<int> updateVec2Tm();
public slots:
	void receivePixmap(QPixmap pix);
	void receiveQImage(QImage ima);

	void startThread();
signals:
	void sendPix2Tm(QPixmap pix);
	void sendPos2Tm(QPolygonF pos);
private:
	QImage re_image;
	QPixmap re_pixmap;
	QVector<int> rect_plot_data;
	QVector<int> temp_rect_data;
	QRect ima_pro_rect;
	QMutex mutex;
	QWidget mainwindow;
	QPolygonF pvalue;
	QRect rect;
	bool replot_state;
	QVector<int> maxvalue;
};

#endif // RECTIMAGEPROGRESS_H
